'\" te
.\" Copyright 1989 AT&T
.\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved
.\" Copyright (c) 2017 Peter Tribble.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PKGTRANS 1 "Mar 2, 2017"
.SH NAME
pkgtrans \- translate package format
.SH SYNOPSIS
.LP
.nf
\fBpkgtrans\fR [\fB-inos\fR] \fIdevice1\fR \fIdevice2\fR [\fIpkginst\fR]...
.fi

.SH DESCRIPTION
.LP
The \fBpkgtrans\fR utility translates an installable package from one format to
another. It translates:
.RS +4
.TP
.ie t \(bu
.el o
a file system format to a datastream
.RE
.RS +4
.TP
.ie t \(bu
.el o
a datastream to a file system format
.RE
.RS +4
.TP
.ie t \(bu
.el o
one file system format to another file system format
.RE
.SH OPTIONS
.LP
The options and arguments for this command are:
.sp
.ne 2
.na
\fB\fB-i\fR\fR
.ad
.RS 15n
Copies only the \fBpkginfo\fR(5) and \fBpkgmap\fR(5) files.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 15n
Creates a new instance of the package on the destination device if any instance
of this package already exists, up to the number specified by the \fBMAXINST\fR
variable in the \fBpkginfo\fR(5) file.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR\fR
.ad
.RS 15n
Overwrites the same instance on the destination device. Package instance will
be overwritten if it already exists.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 15n
Indicates that the package should be written to \fIdevice2\fR as a datastream
rather than as a file system. The default behavior is to write a file system
format on devices that support both formats.
.RE

.SH OPERANDS
.ne 2
.na
\fB\fIdevice1\fR\fR
.ad
.RS 11n
Indicates the source device. The package or packages on this device will be
translated and placed on \fIdevice2\fR. See DEVICE SPECIFIERS, below.
.RE

.sp
.ne 2
.na
\fB\fIdevice2\fR\fR
.ad
.RS 11n
Indicates the destination device. Translated packages will be placed on this
device. See DEVICE SPECIFIERS, below.
.RE

.sp
.ne 2
.na
\fB\fIpkginst\fR\fR
.ad
.RS 11n
Specifies which package instance or instances on \fIdevice1\fR should be
translated. The token \fBall\fR may be used to indicate all packages.
\fBpkginst.*\fR can be used to indicate all instances of a package. If no
packages are defined, a prompt shows all packages on the device and asks which
to translate.
.sp
The asterisk character (\fB*\fR) is a special character to some shells and may
need to be escaped. In the C-Shell, the \fB*\fR must be surrounded by single
quotes (\fB\&'\fR) or preceded by a backslash (\fB\e\fR).
.RE

.SH DEVICE SPECIFIERS
.LP
Packaging tools, including \fBpkgtrans\fR, \fBpkgadd\fR(8), and
\fBpkgchk\fR(8), have options for specifying a package location by specifying
the device on which it resides. Listed below are the device types that a
package can be stored to and retrieved from. Note that source and destination
devices cannot be the same.
.sp
.ne 2
.na
\fBdevice\fR
.ad
.RS 16n
Packages can be stored to a character or block device by specifying the device
identifier as the device. Common examples of this device type are
\fB/dev/rmt/0\fR for a removable magnetic tape and \fB/floppy/floppy0\fR for
the first floppy disk on the system. \fBpkgtrans\fR can also produce regular
file system files in a stream format, which is suitable for storage on a
character device, web server, or as input to \fBpkgadd\fR(8).
.RE

.sp
.ne 2
.na
\fBdevice alias\fR
.ad
.RS 16n
Devices that have been specified in \fB/etc/device.tab\fR are eligible for
being the recipient or source of a package. Common examples of this type of
device specification are \fBspool\fR (the default package device location) and
\fBdisk1\fR. These names correspond to devices specified in
\fB/etc/device.tab\fR
.RE

.sp
.ne 2
.na
\fBdirectory\fR
.ad
.RS 16n
Packages can be stored onto a directory by specifying an absolute path to a
file system directory. The package contents reside in a directory within the
specified directory. The package directory name must be identical to its
\fBPKG\fR specification in the \fBpkginfo\fR(5) file. An example device
specification of this type is \fB/export/packages\fR.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRTranslating All Packages on the Floppy Disk
.sp
.LP
The following example translates all packages on the floppy drive
\fB/dev/diskette\fR and places the translations on \fB/tmp\fR:

.sp
.in +2
.nf
example% pkgtrans /dev/diskette /tmp all
.fi
.in -2
.sp

.LP
\fBExample 2 \fRTranslating Packages on \fB/tmp\fR
.sp
.LP
The following example translates packages \fBpkg1\fR and \fBpkg2\fR on
\fB/tmp\fR and places their translations (that is, a datastream) on the
\fB9track1\fR output device:

.sp
.in +2
.nf
example% pkgtrans /tmp 9track1 pkg1 pkg2
.fi
.in -2
.sp

.LP
\fBExample 3 \fRTranslating Packages on \fB/tmp\fR
.sp
.LP
The following example translates \fBpkg1\fR and \fBpkg2\fR on \fB/tmp\fR and
places them on the diskette in a datastream format:

.sp
.in +2
.nf
example% pkgtrans -s /tmp /dev/diskette pkg1 pkg2
.fi
.in -2
.sp

.LP
\fBExample 4 \fRTranslating a Package Datastream
.sp
.LP
The following example translates a package datastream into a file system format
package:

.sp
.in +2
.nf
example%  pkgtrans /tmp/pkg1.pkg ~/tmp pkg1
.fi
.in -2
.sp

.SH ENVIRONMENT VARIABLES
.LP
The \fBMAXINST\fR variable is set in the \fBpkginfo\fR(5) file and declares the
maximum number of package instances.
.SH EXIT STATUS
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR\fR
.ad
.RS 6n
An error occurred.
.RE

.SH ATTRIBUTES
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	See below.
.TE

.sp
.LP
The command-line syntax is Evolving.
.SH SEE ALSO
.LP
.BR pkginfo (1),
.BR pkgmk (1),
.BR pkgparam (1),
.BR pkgproto (1),
.BR pkginfo (5),
.BR pkgmap (5),
.BR attributes (7),
.BR largefile (7),
.BR installf (8),
.BR pkgadd (8),
.BR pkgask (8),
.BR pkgrm (8),
.BR removef (8)
.sp
.LP
\fIApplication Packaging Developer\&'s Guide\fR
.SH NOTES
.LP
By default, \fBpkgtrans\fR does not translate any instance of a package if any
instance of that package already exists on the destination device. Using the
\fB-n\fR option creates a new instance if an instance of this package already
exists.  Using the \fB-o\fR option overwrites an instance of this package if it
already exists. Neither of these options are useful if the destination device
is a datastream.
.sp
.LP
Package commands are \fBlargefile\fR(7)-aware. They handle files larger than 2
GB in the same way they handle smaller files. In their current implementations,
\fBpkgadd\fR(8), \fBpkgtrans\fR and other package commands can process a
datastream of  up to 4 GB.
